package com.example.administrator.myapplication;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.Window;
import android.widget.Button;


/**
 * Created by Administrator on 2019/3/12.
 */

public class MyDialog extends Dialog{

    Button mBtnOk,mBtnCancel;
    Context mContext;

    public MyDialog(@NonNull Context context) {
        super(context);
        mContext=context;
        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);

    }
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //
        setContentView(R.layout.my_dialog_layout);
        mBtnOk=findViewById(R.id.btn_ok);
        mBtnCancel=findViewById(R.id.btn_cancel);
        mBtnOk.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //点击确定 按钮执行的代码
                ((MainActivity)mContext).setmTvResult("jgdgkghie");
                MyDialog.this.dismiss();
            }
        });

    }
}